﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCompanyName.AbpZeroTemplate.AutoMapper
{
    public class ProjectInfoProfile : Profile
    {
        protected override void Configure()
        {
            Mapper.CreateMap<Prm.Project.ProjectInfo, MyCompanyName.AbpZeroTemplate.Prm.Project.Dto.ProjectOutPut>()
            .ForMember(dto => dto.PlanStartDate, opt => opt.MapFrom(t => t.PlanStartDate.ToString("yyyy-MM-dd")))
            .ForMember(dto => dto.PlanEndDate, opt => opt.MapFrom(t => t.PlanEndDate.ToString("yyyy-MM-dd")))
            .ForMember(dto => dto.TargetEndDate, opt => opt.MapFrom(t => t.TargetEndDate.ToString("yyyy-MM-dd")))
            .ForMember(dto => dto.ProjectStatus, opt => opt.MapFrom(t => t.Status.ToString()))
            .ForMember(dto => dto.PlanProgress, opt => opt.Ignore())
            .ForMember(dto => dto.ActualProgress, opt => opt.Ignore())
            .ForMember(dto => dto.ActualStartDate, opt => opt.Ignore())
            .ForMember(dto => dto.ActualEndDate, opt => opt.Ignore())
            .ForMember(dto => dto.PhaseIds, opt => opt.Ignore())
            .ForMember(dto => dto.PhaseText, opt => opt.Ignore());
        }
    }
}
